import * as user from "@/api/users"
import global from "../utils/Global.js"

const dbid=global.dbId;

export const  loginByAppSecret = async () => {
    

  // let data = {
  //   acctid: "63e39b0694c858",
  //   username: "存良",
  //   appid: "241621_5f2A36uHROk45YUpX+1PU/SHTJ762Cts",
  //   appSecret: "794545b9aba747b5907db97ba0fd6b2b",
  //   lcid: "2052",
  // };

    let data = {
        acctid: global.dbId,
        username: global.username,
        appid: global.appid,
        appSecret: global.appSecret,
        lcid: "2052",
      };
     await user.loginByAppSecret(data).then((result) => {
        sessionStorage.setItem("kdservice-sessionid", result.KDSVCSessionId);
        if (result.Context != null) {
          sessionStorage.setItem("userToken", result.Context.UserToken);
        }
  });
}